package com.company;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

/**
 * @author Administrator
 **/

public class HJ17坐标移动 {

    public static void main(String[] args) {

        List<String> list = Arrays.asList("A", "B", "C", "D", "E", "F", "E", "G", "H", "I", "J", "K", "L", "M", "N",
                        "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
        Scanner scanner = new Scanner(System.in);
        String input = scanner.next();
        String[] strings = input.split(";");
        List<String> stringList = Arrays.stream(strings)
                        .filter(t -> !"".equals(t) && t.length() == 3 || t.length() == 2).collect(Collectors.toList());
        int X = 0;
        int Y = 0;

        for (int k = 0; k < stringList.size(); k++) {

            String getString = stringList.get(k).substring(0, 1);
            String substring = stringList.get(k).substring(1, 2);
            int i = 0;
            if ("A".equals(getString)) {

                if (stringList.get(k).length() == 3) {
                    String substring1 = stringList.get(k).substring(2, 3);
                    StringBuffer append = new StringBuffer(substring).append(substring1);
                    i = Integer.parseInt(String.valueOf(append));
                } else {
                    String substring1 = stringList.get(k).substring(1, 2);
                    i = Integer.parseInt(substring1);
                }

                X -= i;
            }
            if ("S".equals(getString)) {
                if (stringList.get(k).length() == 3) {
                    String substring1 = stringList.get(k).substring(2, 3);
                    StringBuffer append = new StringBuffer(substring).append(substring1);
                    i = Integer.parseInt(String.valueOf(append));
                } else {
                    String substring1 = stringList.get(k).substring(1, 2);
                    i = Integer.parseInt(substring1);
                }

                Y -= i;
            }
            if ("W".equals(getString)) {
                if (stringList.get(k).length() == 3) {
                    String substring1 = stringList.get(k).substring(2, 3);
                    StringBuffer append = new StringBuffer(substring).append(substring1);
                    i = Integer.parseInt(String.valueOf(append));
                } else {
                    String substring1 = stringList.get(k).substring(1, 2);
                    i = Integer.parseInt(substring1);
                }

                Y += i;
            }
            if ("D".equals(getString)) {
                if (stringList.get(k).length() == 3) {
                    String substring1 = stringList.get(k).substring(2, 3);
                    StringBuffer append = new StringBuffer(substring).append(substring1);
                    i = Integer.parseInt(String.valueOf(append));
                } else {
                    String substring1 = stringList.get(k).substring(1, 2);
                    i = Integer.parseInt(substring1);
                }

                X += i;
            }
        }

        System.out.println(X + "," + Y);

    }
}
